<?php

namespace app\index\controller;

use app\common\controller\Frontend;
use app\common\library\Token;

class Zkzsb extends Frontend
{
    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';
    protected $layout = '';

    public function _initialize()
    {
        parent::_initialize();
    }

    public function index(){
        $list = $this -> list;
        $list1 = $list[2]['child'];
        //dump($list);
        //左边第一栏-推荐阅读-图片文章 -- 获取当前页面第一篇
        $lists=[
			$list1[6]['id'],
			$list1[7]['id'],
			$list1[8]['id'],
			$list1[9]['id'],
            $list1[10]['id'],
            $list1[11]['id'],
		];
        $tjyd=model('Getitem')->itemOR($lists,1);
        if(empty($tjyd)){
            $tjyd['title']="";
            $tjyd['image']="";
        }else{
            $tjyd=$tjyd[0];
        }

        //左边第二栏-自考专套本助学信息-分类，9
		$zkztb=model('Getitem')->item($list1[10]['id'],'10,9');

        //中间第一栏-信息动态的前两篇
        $mid1 = model('Getitem')->item($list1[6]['id'],2); 
        
        //中间第二栏-所有栏目的16篇
        $lists=[
            $list1[6]['id'],
			$list1[7]['id'],
			$list1[8]['id'],
			$list1[9]['id'],
            $list1[10]['id'],
            $list1[11]['id'],
        ];
        $mid2 = model('Getitem')->itemOR($lists,16);

        //推荐信息
        $tjxx = model('Getitem')->item($list1[8]['id'],'10,8');

        //中间主考院校，获取自考院校栏目的数据
		$zkyx = model('Getyx')->item(2);

        //信息动态
        $xxdt = model('Getitem')->item($list1[6]['id'],9);

        //招生院校
        $zsyx = model('Getitem')->item($list1[7]['id'],9);
        
        //备考经验
        $bkjy = model('Getitem')->item($list1[8]['id'],8);
        
        //试题资料
        $stzl = model('Getitem')->item($list1[9]['id'],9);

        //疑惑解答
        $yhjd = model('Getitem')->item($list1[10]['id'],9);

        //笔记串讲
        $bjcj = model('Getitem')->item($list1[11]['id'],9);
        
        //自考本科专业
        $zkbkzy = model('Getyx')->itemzkzy_one(2,44);

        //论坛
        $zkzsblt =  model('Getitem')->item($list1[8]['id'],'30,10');



        $this->assign([
            'web_title' =>  '湖北自考网上报名专升本（专套本）、自考本科专业_湖北专升本网',
            'web_keywords'  =>  '湖北自考，网上报名，专套本，自考本科，',
            'web_description'   =>  '湖北专升本网自考专套本频道提供自考专升本和专套本信息，自考本科专业详细信息以及提供自考网上报名；免费服务于专套本学生。',
            'tjyd'      =>  $tjyd,
            'zkztb'     =>  $zkztb,
            'mid1'      =>  $mid1,
            'mid2'      =>  $mid2,
            'tjxx'      =>  $tjxx,
            'zkyx'      =>  $zkyx,
            'xxdt'      =>  $xxdt,
            'zsyx'      =>  $zsyx,
            'bkjy'      =>  $bkjy,
            'stzl'      =>  $stzl,
            'yhjd'      =>  $yhjd,
            'bjcj'      =>  $bjcj,
            'zkbkzy'    =>  $zkbkzy,
            'zkzsblt'   =>  $zkzsblt,
            
        ]);
        return $this->fetch();
    }

    public function tools($tool=0){
        if($tool=='0'){
            return $this -> error('404');
            exit;
        }
        $tool1='ztb_'.$tool;
        #获取name
        $url = model('Getitem')->getcateid($tool1);
        //dump($url);

        $this->assign([
            'web_title' =>  $url['name'],
            'web_keywords'  =>  $url['name'],
            'web_description'   =>  $url['name'],
        ]);

        return $this->fetch($tool);
    }

}